package com.local.coupon.feign;

import com.local.common.util.ResultUtil;
import com.local.coupon.pojo.Coupon;
import com.local.coupon.pojo.CouponListRequestParam;
import com.local.coupon.pojo.UserCouponRecord;
import com.local.coupon.pojo.UserCouponRecordListRequestParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("couponservice")
public interface CouponServiceFeign {

    /**
     * 查询数据列表，支持翻页和搜索
     * @param requestParam
     * @return
     */
    @GetMapping("/coupon/list")
    @ResponseBody
    public ResultUtil couponList(@RequestBody CouponListRequestParam requestParam);

    /**
     * 新增
     * @param coupon
     * @return
     */
    @PostMapping("/coupon/save")
    @ResponseBody
    public ResultUtil couponSave(@RequestBody Coupon coupon);

    /**
     * 通过id查询数据
     * @param couponId
     * @return
     */
    @GetMapping("/coupon/{couponId}")
    @ResponseBody
    public ResultUtil<Coupon> getCouponById(@PathVariable("couponId") Integer couponId);

    /**
     * 修改
     * @return
     */
    @PostMapping("/coupon/update")
    @ResponseBody
    public ResultUtil couponUpdate(@RequestBody Coupon coupon);

    /**
     * 根据id逻辑删除
     * @param couponId
     * @return
     */
    @DeleteMapping("/coupon/{couponId}")
    @ResponseBody
    public ResultUtil couponDelete(@PathVariable("couponId") Integer couponId);


    /**
     * 得到用户的可以正常使用的优惠券，用于订单支付
     * @param requestParam
     * @return
     */
    @GetMapping("/usercouponrecord/getListForPay")
    @ResponseBody
    public ResultUtil<List<UserCouponRecord>> getListForPay(@RequestBody UserCouponRecordListRequestParam requestParam);


    /**
     * 通过id获取数据
     * @param userCouponRecordId
     * @return
     */
    @GetMapping("/usercouponrecord/{userCouponRecordId}")
    @ResponseBody
    public ResultUtil<UserCouponRecord> getUserCouponRecordById(@PathVariable("userCouponRecordId") Integer userCouponRecordId);
}
